<!--
 * @Description: 列表模块    type [course 列表] [details 详情]
 * @Author: 老五 13521685612@163.com
 * @Date: 2024-11-01 01:55:44
 * @LastEditors: 老五 13521685612@163.com
 * @LastEditTime: 2024-11-21 01:44:38
 * @FilePath: /lieshou-app/components/z-course-list.vue
-->

<template>
	<view>
		<view v-if="type==='course'">
			<view class="activity-list" v-for="(item,index) in list" :key="index"
				@click="getDetails(item,index)">
				<image class="activity-list-img" :src="item.cover"></image>
				<!-- <view class="label">新人推荐</view> -->
				<view class="activity-list-bottom">
					<view class="activity-list-bottom-tag">
						<view class="activity-list-bottom-fu"></view>
						<view class="activity-list-bottom-date">{{'已有'+item.init_finish+'人早于你完成学习，'+item.recommend}} </view>
					</view>
					<view class="activity-list-bottom-btn">开始学习</view>
				</view>
			</view>
		</view>
		<view v-if="type==='details'">
			<view class="activity-list active">
				<image class="activity-list-img" :src="cover"></image>
				<view class="activity-list-bottom">
					<view class="activity-list-bottom-tag">
						<view class="activity-list-bottom-fu"></view>
						<view class="activity-list-bottom-date" style="padding-left: 15rpx;">{{'已有'+num+'人参与学习，'+recommend}} </view>
					</view>
					<!-- <view class="activity-list-bottom-btn">参加活动</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "z-course-list",
		// 整理需要-合并
		props: ['list', 'type', 'courses','cover','recommend','num'],
		data() {
			return {

			};
		},
		methods: {
			// 详情
			async getDetails(item, index) {
				console.log('===',item.has_rights)
				if(!item.has_rights){
					uni.navigateTo({
						url: "/pages/course_details?id="+item.id+"&name="+item.name+'$has_rights='+item.has_rights
					})
				}else{
					// 无权益
					uni.navigateTo({
						url: "/pages/video_details?id="+item.id+"&name="+item.name+'&has_rights='+item.has_rights
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.active{
		box-shadow: 0rpx 8rpx 8rpx  rgba(0, 0, 0, 0.25);
	}
	.activity-list {
		width: 690rpx;
		margin: 0 auto;
		overflow: hidden;
		background-color: #fff;
		margin-top: 24rpx;			
		position: relative;
		border-left: 2rpx solid rgba(235, 236, 237, 1);
		border-right: 2rpx solid rgba(235, 236, 237, 1);
		border-bottom: 2rpx solid rgba(235, 236, 237, 1);
		border-radius: 20rpx;
		margin-bottom: 40rpx;
		padding-bottom: 20rpx;

		.activity-list-img {
			width: 100%;
			height: 314rpx;
			object-fit: cover;
			// border-top-left-radius: 15rpx;
			// border-top-right-radius: 15rpx;
		}
		.label{
			position: absolute;
			left: 48rpx;
			top: 30rpx;
			width: 160rpx;
			height: 66rpx;
			line-height: 66rpx;
			text-align: center;
			opacity: 1;
			text-align: center;
			border-radius: 20rpx;
			background: rgba(255, 143, 162, 1);
			/** 文本1 */
			font-size: 28rpx;
			font-weight: 700;
			letter-spacing: 0px;
			color: rgba(255, 255, 255, 1);
			vertical-align: top;

		}

		.activity-list-bottom {
			width: 100%;
			position: relative;
			display: flex;
			align-items: center;
			padding-bottom: 20rpx;
			.activity-list-bottom-title {
				margin: 24rpx 0rpx 20rpx 36rpx;
				font-size: 28rpx;
				font-weight: 500;
				color: rgba(0, 0, 0, 1);
				text-align: left;
				vertical-align: top;
			}

			.activity-list-bottom-tag {
				display: inline-block;
				width: auto;
				// text-align: center;
				height: 34rpx;
				// position: relative;
				padding-left: 20rpx;

				

				.activity-list-bottom-date {
					font-size: 24rpx;
					font-weight: 500;
					margin-left: 5rpx;
					position: relative;
					text-align: center;
					bottom: 0rpx;
					color: rgba(0, 0, 0, 1);
					vertical-align: top;
				}
				.activity-list-bottom-fu {
					width: auto;
					height: 14rpx;
					position: relative;
					top: 30rpx;
					will-change: transform, filter;
					border-radius: 10rpx;
					background: rgba(252, 205, 229, 1);
					opacity: 1;
					filter: blur(6rpx);
				}


			}

			.activity-list-bottom-btn {
				margin-right: 26rpx;
				width: auto;
				position: absolute;
				right: 23rpx;
				bottom:0rpx;
				font-size: 24rpx;
				font-weight: 500;
				padding: 6rpx 20rpx;
				color: rgba(255, 255, 255, 1);
				text-align: center;
				vertical-align: top;
				border-radius: 30rpx;
				background: rgba(0, 0, 0, 1);
			}
		}

	}
</style>